package com.mallcloud.mall.app.api.entity.vo;

import com.alibaba.fastjson.JSONObject;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;

/**
 * 微信支付 API V3
 */
@Slf4j
@UtilityClass
public class WechatPayV3Response {

    public static JSONObject success(HttpServletResponse response) {
        response.setStatus(200);
        JSONObject res = new JSONObject();
        res.put("code", "SUCCESS");
        res.put("message", "成功");
        return res;
    }

    public static JSONObject fail(HttpServletResponse response) {
        return fail(response, "失败");
    }

    public static JSONObject fail(HttpServletResponse response, String msg) {
        response.setStatus(500);
        JSONObject res = new JSONObject();
        res.put("code", "FAIL");
        res.put("message", msg);
        return res;
    }

}
